<?php
namespace app\middleware;

use core\Request;
use core\Response;


class Group {
    public function handle(Request $request, Response $response, \Closure $next): void {
        echo 'Group(路由分组) 中间件 call before<br>';
        $num = mt_rand(0, 1);
        if ($num == 0) {
            $response->abort('请先登录');
            return;
        }

        $next();
        echo 'Group(路由分组) 中间件 call before<br>';
    }
}
